package com.zuilapsa.jmc.actions;

import java.util.Iterator;
import java.util.List;

import org.dom4j.Element;

import com.zuilapsa.jmc.userInterfaces.UserInterfaceSession;


public class ActionDisplay extends ActionNull {

	public void execute(UserInterfaceSession interfaceSession, String[] args) {
		// TODO consider updating to level interface (get rid of xml)
		Element def = interfaceSession.getDefinitionElement();
//		Element cfg = interfaceSession.getConfigElement();

		interfaceSession.printMessageInfo("properties:");

		
		List list = def.selectNodes("/level/property");

		for (Iterator iter = list.iterator(); iter.hasNext();) {
			Element property = (Element) iter.next();
			interfaceSession.printMessageInfo(" " + property.attribute("name")
					+ " = " + property.attribute("value"));
		}

		interfaceSession.printMessageInfo("levels:");

		list = def.selectNodes("/level/level");

		for (Iterator iter = list.iterator(); iter.hasNext();) {
			Element property = (Element) iter.next();
			interfaceSession.printMessageInfo(" " + property.attributeValue("name"));
		}
	}
	public String getHelpString() {
		return "Displays all properties and sub levels.";
	}
}
